<template>
  <view class="storeSetupPage" :class="{ popupLock: popupLock }">
    <!--    <nav-bar title="门店设置" bgColor="#ffb72f" titleColor="#fff" />-->

    <view class="content">
      <u--form
        labelPosition="left"
        :model="formData"
        :rules="rules"
        ref="form1"
        labelWidth="160rpx"
      >
        <div class="main">
          <view class="calssTitle">门店信息</view>
          <u-form-item label="门店logo" prop="fileList" ref="item1">
            <u-upload
              :fileList="fileList1"
              @afterRead="afterRead"
              @delete="deletePic"
              name="1"
              multiple
              :maxCount="1"
            ></u-upload>
          </u-form-item>
          <div class="border">
            <u-form-item label="门店简称" prop="storeName" ref="item1">
              <view class="calcuBox">
                <view class="calcuInput">
                  <u--input
                    placeholder="请输入内容"
                    :customStyle="{
                      border: 'none',
                      height: '54rpx',
                      padding: '13rpx 22rpx',
                      fontSize: '30rpx',
                    }"
                    border="surround"
                    v-model="formData.storeName"
                    :maxlength="20"
                  ></u--input>
                </view>
                <view class="maxNum"
                  >{{ formData.storeName.length || 20 }} / 20</view
                >
              </view>
            </u-form-item>
          </div>

          <div class="border" v-if="isBusinessDistrictMainStore">
            <u-form-item
              label="门店分类"
              prop="pubDomainClassifyId"
              ref="item1"
            >
              <view class="areaBox" @click="isShowClassify = true">
                <text v-if="classifyText" style="color: #333333">{{
                  classifyText
                }}</text>
                <text v-else>请选择门店分类</text>
                <view class="iconfont icon-xuanzeqizhankai"></view>
              </view>
            </u-form-item>
          </div>
          <div class="border" v-if="pubUserInfo && pubUserInfo.mainShopStatus">
            <u-form-item
              label="门店类型"
              prop="pubDomainIndustryId"
              ref="item1"
            >
              <view class="areaBox" @click="isShowIndustry = true">
                <text v-if="industryText" style="color: #333333">{{
                  industryText
                }}</text>
                <text v-else>请选择门店类型</text>
                <view class="iconfont icon-xuanzeqizhankai"></view>
              </view>
            </u-form-item>
          </div>
          <div class="border">
            <u-form-item label="门店地址" prop="provinceCode" ref="item1">
              <view class="areaBox" @click="openAreaPicker">
                <view v-if="formData.provinceCode" class="areaTxt"
                  >{{ formData.provinceCode }}/{{ formData.cityCode }}/{{
                    formData.areaCode
                  }}</view
                >
                <view v-else>省/市/区</view>
                <view class="iconfont icon-xuanzeqizhankai"></view>
              </view>
              <area-picker
                ref="areaPicker"
                @getAreaPicker="getAreaPicker"
              ></area-picker>
            </u-form-item>
          </div>
          <div class="border">
            <u-form-item label=" " prop="addressDetail" ref="item1">
              <view>
                <u--textarea
                  v-model="formData.addressDetail"
                  placeholder="请输入门店详情"
                ></u--textarea>
              </view>
            </u-form-item>
          </div>

          <u-form-item label=" " prop="location" ref="item1"
            ><view @click="getLocation" class="getLocation"
              >定位</view
            ></u-form-item
          >
          <div class="border">
            <u-form-item label="客服电话" prop="kfPhone" ref="item1">
              <u--input
                :customStyle="{
                  height: '54rpx',
                  padding: '13rpx 22rpx',
                  fontSize: '30rpx',
                }"
                placeholder="请输入内容"
                border="surround"
                v-model="formData.kfPhone"
              ></u--input>
            </u-form-item>
          </div>
        </div>

        <div class="main store-setting">
          <view class="calssTitle">门店设置</view>
          <u-form-item label="营业时间" prop="time" ref="item1">
            <view class="timeBox">
              <view @click="openSelectTimePicker" class="time">
                <view
                  class="iconfont icon-shijian"
                  style="color: #e4e7ed"
                ></view>
                <view
                  >{{ formData.busTime.openHour }}:{{
                    formData.busTime.openMin
                  }}</view
                >
                <view>-</view>
                <view
                  >{{
                    formData.busTime.openHour > formData.busTime.closeHour
                      ? "次日"
                      : ""
                  }}{{ formData.busTime.closeHour }}:{{
                    formData.busTime.closeMin
                  }}</view
                >
              </view>
              <view class="switchBox">
                <u-switch
                  v-model="formData.busTimeBoolean"
                  size="20"
                ></u-switch>
                <view style="margin-left: 8rpx">不营业</view>
              </view>
            </view>
            <select-time-picker
              ref="selectTimePicker"
              @getTime="getTime"
              @close="popupLock = false"
              :preTime="formData.busTime"
            ></select-time-picker>
          </u-form-item>

          <block v-if="formData.industry < 100">
            <u-form-item label="就餐方式" prop="industryMode" ref="item1">
              <u-checkbox-group
                v-model="formData.caterList"
                iconPlacement="left"
                placement="row"
              >
                <u-checkbox
                  :customStyle="{ marginRight: '8px' }"
                  v-for="(item, index) in formData.caterOption"
                  :key="index"
                  :label="item.name"
                  :name="item.name"
                ></u-checkbox>
              </u-checkbox-group>
            </u-form-item>
            <u-form-item v-if="formData.caterList.includes('打包')">
              <view
                style="margin-left: 180rpx; display: flex; align-items: center"
              >
                <view style="float: left">打包费</view>
                <view style="width: 200rpx; margin: 0 16rpx"
                  ><u--input
                    border="surround"
                    v-model="formData.caterPackFee"
                  ></u--input
                ></view>
                <view style="float: left">元</view>
              </view>
            </u-form-item>
            <u-form-item
              v-if="
                formData.caterList.includes(
                  GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_LOCAL
                )
              "
            >
              <view
                style="margin-left: 180rpx; display: flex; align-items: center"
              >
                <view style="float: left">配送费</view>
                <view style="width: 200rpx; margin: 0 16rpx"
                  ><u--input
                    border="surround"
                    v-model="formData.caterPatchFee"
                  ></u--input
                ></view>
                <view style="float: left">元</view>
              </view>
            </u-form-item>
          </block>
          <block v-else>
            <u-form-item label="配送方式" prop="industryMode" ref="item1">
              <u-checkbox-group
                v-model="formData.dispatchList"
                iconPlacement="left"
                placement="row"
              >
                <u-checkbox
                  :customStyle="{ marginRight: '8px' }"
                  v-for="(item, index) in formData.dispatchOption"
                  :key="index"
                  :label="item.name"
                  :name="item.name"
                ></u-checkbox>
              </u-checkbox-group>
            </u-form-item>
            <u-form-item v-if="formData.dispatchList.includes('自提')">
              <view
                style="margin-left: 180rpx; display: flex; align-items: center"
              >
                <view style="float: left">包装费</view>
                <view style="width: 200rpx; margin: 0 16rpx"
                  ><u--input
                    border="surround"
                    v-model="formData.disPackFee"
                  ></u--input
                ></view>
                <view style="float: left">元</view>
              </view>
            </u-form-item>
            <u-form-item
              v-if="
                formData.dispatchList.includes(
                  GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_LOCAL
                )
              "
            >
              <view
                style="margin-left: 180rpx; display: flex; align-items: center"
              >
                <view style="float: left">配送费</view>
                <view style="width: 200rpx; margin: 0 16rpx"
                  ><u--input
                    border="surround"
                    v-model="formData.disPatchFee"
                  ></u--input
                ></view>
                <view style="float: left">元</view>
              </view>
            </u-form-item>
          </block>
          <div class="border">
            <u-form-item label="店铺描述" prop="" ref="item1"
              ><u--textarea
                v-model="formData.storeDes"
                count
                maxlength="200"
                cursorSpacing="90"
              ></u--textarea
            ></u-form-item>
          </div>

          <div class="border">
            <u-form-item label="店铺分享文案" prop="" ref="item1">
              <u--textarea
                v-model="formData.storeShareTxt"
                count
                cursorSpacing="90"
                maxlength="40"
              ></u--textarea>
            </u-form-item>
          </div>
        </div>
      </u--form>
    </view>
    <view class="submit">
      <u-button
        @click="cancel"
        :customStyle="{ width: '250rpx' }"
        type="primary"
        :plain="true"
        text="取消"
      ></u-button>
      <u-button
        @click="submit"
        :customStyle="{ width: '250rpx' }"
        type="primary"
        text="保存"
      ></u-button>
    </view>
    <u-picker
      :show="isShowClassify"
      :columns="classifyList"
      :defaultIndex="classifyCurrent"
      @confirm="handleConfirmClassify"
      @cancel="isShowClassify = false"
      keyName="name"
    ></u-picker>
    <u-picker
      :show="isShowIndustry"
      :columns="industryList"
      :defaultIndex="industryCurrent"
      @cancel="isShowIndustry = false"
      @confirm="handleConfirmIndustry"
      keyName="name"
    ></u-picker>
  </view>
</template>

<script>
import selectTimePicker from "@/components/pageComponents/sp-store/select-time-picker/index.vue";
import areaPicker from "@/components/pageComponents/sp-store/area-picker/index.vue";
import {
  uploadAvater,
  getShopDetail,
  saveShopDetail,
} from "@/service/api/sp-store/index.js";
import { getToken } from "@/utils/auth";
import {
  GLOBAL_ORDER_DELIVER_METHOD,
  GLOBAL_ORDER_DELIVER_METHOD_TEXT,
} from "@/const/order";
import {
  getIndustryList,
  getPubClassifyList,
} from "@/service/api/sp-store/business-district";
import { mapState } from "@dcloudio/vue-cli-plugin-uni/packages/vuex3/dist/vuex.common";
export default {
  components: {
    selectTimePicker,
    areaPicker,
  },
  data() {
    return {
      GLOBAL_ORDER_DELIVER_METHOD,
      GLOBAL_ORDER_DELIVER_METHOD_TEXT,
      popupLock: false,
      // 规则校验
      rules: {
        fileList: {
          asyncValidator: (rule, value, callback) => {
            if (this.fileList1.length < 1) {
              callback(new Error("请上传logo"));
            } else {
              callback();
            }
          },
        },
        storeName: {
          type: "string",
          required: true,
          message: "请输入门店简称",
          trigger: ["blur", "change"],
        },
        provinceCode: {
          type: "string",
          required: true,
          message: "请输入门店地址",
          trigger: ["blur", "change"],
        },
        addressDetail: {
          type: "string",
          required: true,
          message: "请输入门店地址",
          trigger: ["blur", "change"],
        },
        location: {
          asyncValidator: (rule, value, callback) => {
            if (!this.formData.longitude) {
              callback(new Error("请定位门店地址"));
            } else {
              callback();
            }
          },
        },
        kfPhone: [
          {
            required: true,
            message: "请输入客服电话",
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              return uni.$u.test.mobile(value);
            },
            message: "手机号码不正确",
            trigger: ["change", "blur"],
          },
        ],
        time: {
          asyncValidator: (rule, value, callback) => {
            let { openHour, openMin, closeHour, closeMin } =
              this.formData.busTime;
            if (
              openHour === "00" &&
              openMin === "00" &&
              closeHour === "00" &&
              closeMin === "00"
            ) {
              callback(new Error("请设置营业时间"));
            } else {
              callback();
            }
          },
        },
        industryMode: {
          asyncValidator: (rule, value, callback) => {
            if (
              this.formData.industry < 100 &&
              this.formData.caterList.length < 1
            ) {
              callback(new Error("请选择就餐方式"));
            } else if (
              this.formData.industry >= 100 &&
              this.formData.dispatchList.length < 1
            ) {
              callback(new Error("请选择配送方式"));
            } else {
              callback();
            }
          },
        },
      },
      fileList1: [],
      formData: {
        /* 门店信息 */
        id: "",
        industry: "", // < 100 时就餐方式，否则配送方式
        storeName: "",
        kfPhone: "",
        // 地址
        provinceCode: "",
        cityCode: "",
        areaCode: "",
        addressDetail: "",
        longitude: "",
        latitude: "",
        pubDomainClassifyId: "",
        pubDomainIndustryId: "",
        /* 门店设置 */
        busTime: {
          openHour: "00",
          openMin: "00",
          closeHour: "00",
          closeMin: "00",
        },
        busTimeBoolean: false,
        // 就餐方式
        caterList: [],
        caterOption: [
          {
            name: GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_HALL_FOOD,
            disabled: false,
          },
          {
            name: GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_PACK,
            disabled: false,
          },
          {
            name: GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_LOCAL,
            disabled: false,
          },
        ],
        caterPackFee: "",
        caterPatchFee: "",
        // 配送方式
        dispatchList: [],
        dispatchOption: [
          {
            name: GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_SHOP_CONSUME,
            disabled: false,
          },
          {
            name: GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_SELF_PICKUP,
            disabled: false,
          },
          {
            name: GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_LOCAL,
            disabled: false,
          },
        ],
        disPackFee: "",
        disPatchFee: "",
        // 店铺描述
        storeDes: "",
        // 店铺分享文案
        storeShareTxt: "",
      },
      shopDetail: null,
      isShowClassify: false,
      classifyList: [],
      isShowIndustry: false,
      industryList: [],
    };
  },
  onReady() {
    //如果需要兼容微信小程序，并且校验规则中含有方法等，只能通过setRules方法设置规则。
    this.$refs.form1.setRules(this.rules);
  },
  mounted() {
    this.shopDetailFun();
    if (this.pubUserInfo.mainShopStatus) {
      this.rules.pubDomainIndustryId = {
        type: "number",
        required: true,
        message: "请输入门店类型",
        trigger: ["blur", "change"],
      };
    }
    if (this.isBusinessDistrictMainStore) {
      this.rules.pubDomainClassifyId = {
        type: "number",
        required: true,
        message: "请输入门店分类",
        trigger: ["blur", "change"],
      };
    }
  },
  computed: {
    ...mapState("sp-common/auth", ["pubUserInfo"]),
    isBusinessDistrictMainStore({ pubUserInfo }) {
      return (
        pubUserInfo &&
        pubUserInfo.mainShopStatus &&
        pubUserInfo.pubDomainShopVo.pubTag === 1
      );
    },
    classifyCurrent({ formData, classifyList }) {
      if (classifyList[0] && formData?.pubDomainClassifyId) {
        return [
          classifyList[0]?.findIndex(
            (v) => v.id === Number(formData?.pubDomainClassifyId)
          ),
        ];
      }
      return [0];
    },
    industryCurrent({ formData, industryList }) {
      if (industryList[0] && formData?.pubDomainIndustryId) {
        return [
          industryList[0]?.findIndex(
            (v) => v.id === Number(formData?.pubDomainIndustryId)
          ),
        ];
      }
      return [0];
    },

    classifyText({ formData, classifyList }) {
      return (
        classifyList[0]?.filter(
          (classify) => classify.id === Number(formData?.pubDomainClassifyId)
        )[0]?.name || null
      );
    },

    industryText({ formData, industryList }) {
      return (
        industryList[0]?.filter(
          (industry) =>
            Number(industry.id) === Number(formData?.pubDomainIndustryId)
        )[0]?.name || null
      );
    },
  },
  methods: {
    async getClassifyList() {
      const res = await getPubClassifyList();
      this.classifyList = [res];
    },
    handleConfirmClassify(e) {
      const { value } = e;
      const id = value[0].id;
      this.formData.pubDomainClassifyId = id;
      this.isShowClassify = false;
    },
    async getIndustry() {
      const res = await getIndustryList();
      let industryList = [];
      for (const resKey in res) {
        let obj = {
          name: res[resKey],
          id: Number(resKey),
        };
        industryList.push(obj);
      }
      this.industryList = [industryList];
    },
    handleConfirmIndustry(e) {
      const { value } = e;
      const id = value[0].id;
      this.formData.pubDomainIndustryId = id;
      console.log("=====", id);
      this.isShowIndustry = false;
    },
    // 上传图片
    deletePic(event) {
      this[`fileList${event.name}`].splice(event.index, 1);
    },
    // 新增图片
    async afterRead(event) {
      // 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
      let lists = [].concat(event.file);
      let fileListLen = this[`fileList${event.name}`].length;
      lists.map((item) => {
        this[`fileList${event.name}`].push({
          ...item,
          status: "uploading",
          message: "上传中",
        });
      });
      for (let i = 0; i < lists.length; i++) {
        const result = await this.uploadFilePromise(lists[i].url);
        let item = this[`fileList${event.name}`][fileListLen];
        this[`fileList${event.name}`].splice(
          fileListLen,
          1,
          Object.assign(item, {
            status: "success",
            message: "",
            url: result,
          })
        );
        fileListLen++;
      }
    },
    uploadFilePromise(url) {
      let params = {
        file: url,
      };
      // uploadAvater(params).then(res => {
      // 	console.log('上传')
      // })
      let headers = { "X-BUSINESS-TOKEN": getToken() };
      return new Promise((resolve, reject) => {
        let a = uni.uploadFile({
          url: `${process.env.VUE_APP_BASE_URL}/business_admin/upload`, // 仅为示例，非真实的接口地址
          filePath: url,
          name: "file",
          formData: {},
          header: headers,
          success: (res) => {
            setTimeout(() => {
              let { baseUrl, path } = JSON.parse(res.data).data;
              let imgUrl = baseUrl + path;
              resolve(imgUrl);
            }, 1000);
          },
        });
      });
    },

    // 省市区
    openAreaPicker() {
      this.$refs.areaPicker.open();
    },
    getAreaPicker(val) {
      console.log("接收省市区", val);
      this.formData.provinceCode = val.value[0];
      this.formData.cityCode = val.value[1];
      this.formData.areaCode = val.value[2];
    },
    getLocation() {
      let that = this;
      uni.chooseLocation({
        longitude: that.formData.longitude,
        latitude: that.formData.latitude,
        success: function (res) {
          console.log("位置名称：" + res.name);
          console.log("详细地址：" + res.address);
          console.log("纬度：" + res.latitude);
          console.log("经度：" + res.longitude);
          if (res.address) {
            that.formData.addressDetail = res.address;
            that.formData.longitude = res.longitude;
            that.formData.latitude = res.latitude;
          }
        },
      });
    },
    // 营业时间
    openSelectTimePicker() {
      this.$refs.selectTimePicker.open();
      this.popupLock = true;
    },
    getTime(e) {
      console.log("营业时间", e);
      this.formData.busTime = e;
      this.popupLock = false;
    },

    // 提交
    cancel() {
      this.$Router.back();
    },
    submit() {
      this.$refs.form1
        .validate()
        .then((res) => {
          this.saveShopFun();
        })
        .catch((errors) => {
          uni.$u.toast("信息不全，请补充");
        });
    },
    saveShopFun() {
      let that = this;
      // 格式化
      let params = Object.assign({}, this.formData);
      let data = {
        id: params.id,
        logo: this.fileList1[0].url.replace(
          "https://hyyxboss.oss-cn-shenzhen.aliyuncs.com/",
          ""
        ),
        shopName: params.storeName,
        phone: params.kfPhone,
        // 地址
        provinceCode: params.provinceCode,
        cityCode: params.cityCode,
        areaCode: params.areaCode,
        address: params.addressDetail,
        longitude: params.longitude,
        latitude: params.latitude,
        // 营业时间
        openHour: params.busTime.openHour,
        openMin: params.busTime.openMin,
        closeHour: params.busTime.closeHour,
        closeMin: params.busTime.closeMin,
        isTrade: params.busTimeBoolean ? 0 : 1, //0不营业1营业
        // 就餐方式
        diningConfigJson: {
          isEatShop: !!params.caterList.includes(
            GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_HALL_FOOD
          ),
          isDelivery: !!params.caterList.includes(
            GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_LOCAL
          ),
          deliveryFee: params.caterPatchFee * 100,
          isPack: !!params.caterList.includes(
            GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_PACK
          ),
          packFee: params.caterPackFee * 100,
        },
        // 配送方式
        deliveryServiceConfigJson: {
          isShopConsume: !!params.dispatchList.includes(
            GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_SHOP_CONSUME
          ),
          isSelfPack: !!params.dispatchList.includes(
            GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_SELF_PICKUP
          ),
          packFee: params.disPackFee * 100,
          isDelivery: !!params.dispatchList.includes(
            GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_LOCAL
          ),
          deliveryFee: params.disPatchFee * 100,
        },
        desc: params.storeDes,
        copywrite: params.storeShareTxt,
        pubDomainClassifyId: params.pubDomainClassifyId,
        pubDomainIndustryId: params.pubDomainIndustryId,
      };
      saveShopDetail(data)
        .then((res) => {
          uni.showToast({
            title: "修改成功",
            duration: 2000,
            icon: "success",
            success: function () {
              setTimeout(() => {
                that.$Router.back();
              }, 2000);
            },
          });
        })
        .catch((err) => {
          uni.showToast({
            icon: "none",
            title: err.msg || "错误",
          });
        });
    },

    // 详情
    shopDetailFun() {
      console.log(this.$Route.query);
      const { id } = this.$Route.query;
      getShopDetail({ pubShopId: id }).then((res) => {
        console.log("门店详情", res);
        this.shopDetail = res;
        this.getClassifyList();
        this.getIndustry();
        // 格式化
        // 门店信息
        this.fileList1.push({
          url: `https://hyyxboss.oss-cn-shenzhen.aliyuncs.com/${res.logo}`,
        });
        let params = Object.assign({}, this.formData);
        params.id = res.id;
        params.industry = res.industry;
        params.storeName = res.shopName;
        params.kfPhone = res.phone;
        // 地址
        params.provinceCode = res.provinceCode;
        params.cityCode = res.cityCode;
        params.areaCode = res.areaCode;
        params.addressDetail = res.address;
        params.longitude = res.longitude;
        params.latitude = res.latitude;
        params.pubDomainIndustryId = res?.pubDomainIndustryId
          ? Number(res?.pubDomainIndustryId)
          : "";
        params.pubDomainClassifyId = res?.pubDomainClassifyId
          ? Number(res?.pubDomainClassifyId)
          : "";
        // 营业时间
        let busTime = {
          openHour:
            String(res.openHour).length < 2 ? "0" + res.openHour : res.openHour,
          openMin:
            String(res.openMin).length < 2 ? "0" + res.openMin : res.openMin,
          closeHour:
            String(res.closeHour).length < 2
              ? "0" + res.closeHour
              : res.closeHour,
          closeMin:
            String(res.closeMin).length < 2 ? "0" + res.closeMin : res.closeMin,
        };
        params.busTime = busTime;
        params.busTimeBoolean = !res.isTrade; //0不营业1营业
        // 就餐方式
        let { isEatShop, isPack, packFee, isDelivery, deliveryFee } =
          res.diningConfigJson;
        if (isEatShop) {
          params.caterList.push(GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_HALL_FOOD);
        }
        if (isPack) {
          params.caterList.push(GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_PACK);
          params.caterPackFee = packFee / 100;
        }
        if (isDelivery) {
          params.caterList.push(GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_LOCAL);
          console.log("计算配送费", deliveryFee);
          params.caterPatchFee = deliveryFee / 100;
        }
        // 配送方式
        let {
          isShopConsume,
          isSelfPack,
          packFee: disPackFee,
          isDelivery: is_Delivery,
          deliveryFee: disPatchFee,
        } = res.deliveryServiceConfigJson;
        if (isShopConsume) {
          params.dispatchList.push(
            GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_SHOP_CONSUME
          );
        }
        if (isSelfPack) {
          params.dispatchList.push(
            GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_SELF_PICKUP
          );
          params.disPackFee = disPackFee / 100;
        }
        if (is_Delivery) {
          params.dispatchList.push(GLOBAL_ORDER_DELIVER_METHOD_TEXT.PUB_LOCAL);
          params.disPatchFee = disPatchFee / 100;
        }
        // 店铺描述
        params.storeDes = res.desc;
        // 店铺分享文案
        params.storeShareTxt = res.copywrite;
        this.formData = params;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.popupLock {
  height: 100vh;
  overflow: hidden;
}
.storeSetupPage {
  padding: 20rpx;
  box-sizing: border-box;
  background-color: #f7f7f7;
  .calssTitle {
    font-weight: bold;
    font-size: 36rpx;
  }
  .content {
    .calcuBox {
      display: flex;
      justify-content: space-between;
      align-items: center;
      text-align: center;
      border: 2rpx solid #e5e7ed;
      border-radius: 8rpx;
      color: #c0c4cc;
      .calcuInput {
        flex: 3;
      }
      .maxNum {
        flex: 1;
      }
    }
    .areaBox {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border: 2rpx solid #e5e7ed;
      border-radius: 8rpx;
      height: 54rpx;
      padding: 13rpx 22rpx;
      font-size: 30rpx;
      color: #c0c4cc;
      .areaTxt {
        color: #000000;
      }
    }
    .getLocation {
      color: $u-primary;
    }
    .timeBox {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 24rpx;
      .time {
        flex: 1;
        display: flex;
        justify-content: space-around;
        align-items: center;
        border: 2rpx solid #e4e7ed;
        border-radius: 8rpx;
        padding: 12rpx 18rpx;
        box-sizing: border-box;
      }
      .switchBox {
        flex: 1;
        display: flex;
        justify-content: flex-end;
        align-items: center;
      }
    }
  }
  .main {
    width: calc(686rpx - 26 * 2rpx);
    padding: 42rpx 26rpx;
    background-color: white;
    border-radius: 12rpx;
    margin: 0 auto;
  }
  .store-setting {
    margin-top: 26rpx;
  }
  .submit {
    width: 100%;
    display: flex;
    justify-content: space-around;
    margin-top: 33rpx;
  }
}
</style>
